<template>
  
  <div class="box" ref="box">
      <div class="toubu">
          <Header />
      </div>
    
    
    <div class="bj">
        <!-- <Swipe/> -->
        <img src="../assets/imgs/bj.png" alt="">
        <div class="shop">
            <div class="flex">
                <div>
                    <p>{{shop.name}}</p>
                    <p>商家配送约42分钟·月售185·可自取</p>
                </div>
                <img :src="image_url" alt="">
            </div>
            <i>简绍：{{shop.jshao}}</i>
            <p class="gG">
                 <van-notice-bar
                left-icon="volume-o"
                text="在代码阅读过程中人们说脏话的频率是衡量代码质量的唯一标准。"
                />
            </p>
           

        </div>
    </div>

    <ul class="fenlu" ref="fenlu">
        <li class="active" @click="tiao" data-path="dianCan">点餐</li>
        <li @click="tiao" data-path="pingJia">评价</li>
        <li @click="tiao" data-path="shangJia">商家</li>
    </ul>
    <div class="san">
        <router-view></router-view>
    </div>
    
   
  </div>
</template>

<script>
// @ is an alias to /src
import Header from "../components/header";
import Swipe from '../components/swipe';

import { ajax_shopList} from "../ajax/index";
import {mapState} from 'vuex'

export default {
  name: "",
  data() {
    return {
      fujin: [],
      shop:{},
      
      fen:4.2,
      yuan:'3公里',
      time:"45分钟",
      yeNum:1,
      image_url:''
    };
  },
  methods:{
   login(){
       this.$router.push('/login')
   },
   xiang(id){
       this.$router.push("/xianQin?id="+id)
   },
   tiao(e){
   
       e.target.parentNode.children.forEach(element => {
        
              element.classList.remove("active")

       });
       e.target.classList.add("active");

      this.$router.push(`/${e.target.dataset.path}`)
   },
   scroll(){
       var B=this.$refs.fenlu.offsetTop;
        
           var C=document.body.scrollTop||document.documentElement.scrollTop;
        
           if(C>=B){
               this.$refs.fenlu.classList.add('ding')
           }else if(C<B){
               this.$refs.fenlu.classList.remove('ding')
           }
   },
   
  
  },
  computed: {
      ...mapState(['di','login1']),
      
  },
  
 
  updated(){
    //    console.log(this.login1)
  },

  watch:{
   
  },
  created(){
    ajax_shopList().then(data=>{
        this.shop=data.shopList[0];
        // console.log(this.shop)
        this.$store.commit('setShop',this.shop)
        this.image_url=`http://127.0.0.1:8888/imgs/shop/${this.shop.shop_img}`
        
    })
    
  },
  mounted(){
      
    //   var box=document.getElementById("box")
    // //   console.log(this.$refs.fu)
     window.addEventListener('scroll',this.scroll)
  },
  destroyed(){
    window.removeEventListener('scroll',this.scroll)
  },
  components: {
    Header,
    Swipe,
   
  }
};
</script>

<style scoped>
    

.san{
    width: 100vw;
    height: 116vh;
   
}

.box >>> .van-notice-bar{
   width: 90vw !important;
   height: 20px !important;
   line-height: 10px !important;
   font-size: 10px !important;
}
.gG >>> .van-notice-bar__content{
    font-size: 10px !important;
}
.ding{
    position:fixed;
    top: 1.8vh;
    background-color: white;
    width: 100vw;
    z-index: 1000;
}
.box{
    position: relative;
}

/* .box >>> .van-rate{
    width: 80px;
} */
aside{
    position: fixed;
    display: flex;
    justify-content: space-between;
    font-family:inherit;
    align-items: center;
    padding:1.8vh 3vw ;
    bottom: 8vh;
    width: 94vw;
    color: white;
    background-color:rgba(0, 0, 0, 0.801);
}
aside>button{
    outline: none;
    border: none;
    color: white;
    border-radius: 4px;
    padding: .6vh 1.6vw;
    background-color: rgb(105, 105, 241);
}
.toubu{
    position: fixed;
    top: 0;
    z-index: 1000;
}
.bj{
    margin-top: 7.5vh;
    height: 25vh;
    position: relative;
}
.bj>img{
    width: 100%;
    height: 100%;
}

.shop{
   width: 88vw;
   height:100px;
   margin: 0 auto;
   position: absolute;
   top:50%;
   left:3vw;
   padding: 3vw;
   /* background-color: white; */
   background-image: linear-gradient(to left top,rgb(253, 251, 251),rgb(226, 218, 218));
   border-radius: 3px;
}
.flex>div>p:first-child{
    font-size: 20px;
    
    margin-bottom: 2.8vw;
    /* color: red; */
}
.flex>div>p:last-child{
    font-size: 12px;
    font-family: "黑体";
    margin-bottom: 1vw;
    /* color: red; */
}
.shop>i{
    margin: 1vw 0;
    font-size: 10px;
    font-style: normal;
    color: indigo;
}
.shop>p{
    width: 84%;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    font-size: 10px;
    color: gray;
    margin-top: 1.8vw;
}
.flex{
    display: flex;
    justify-content: space-between;
}
.flex>img{
    width: 15vw;
    height: 15vw;
    border-radius: 5px;
}
.fenlu{
    display: flex;
    margin-top: 10vw;
    padding: 2vw 4vw;
}
.fenlu>li{
    margin-right: 5vw;
    padding: 1vw 0vw;
    position: relative;
    display: block;
    /* margin-bottom: 1vw; */
}
.fenlu>li:after{
    content: '';
    display: block;
    margin-top: 1vw;
    /* width: 0; */
    /* border: 1.8px solid red;
    border-radius: 5px; */
    /* border:50px; */
}
.active::after{
    content:'';
    display:block;
    margin-top: 1vw;
    border: 1.58px solid rgb(45, 45, 230);
    border-radius: 5px;
    /* width: 30px;
    transition: all 1s; */
    
}
@font-face {
  font-family: 'iconfont';  /* project id 2408325 */
  src: url('//at.alicdn.com/t/font_2408325_l6sx94jz8ke.eot');
  src: url('//at.alicdn.com/t/font_2408325_l6sx94jz8ke.eot?#iefix') format('embedded-opentype'),
  url('//at.alicdn.com/t/font_2408325_l6sx94jz8ke.woff2') format('woff2'),
  url('//at.alicdn.com/t/font_2408325_l6sx94jz8ke.woff') format('woff'),
  url('//at.alicdn.com/t/font_2408325_l6sx94jz8ke.ttf') format('truetype'),
  url('//at.alicdn.com/t/font_2408325_l6sx94jz8ke.svg#iconfont') format('svg');
}
/* .box{
  background-color: white;
} */
.fujin {
  width: 100vw;
  margin-top: 15px;
  background-color: #f5f5f5;
}

.fujin>p{
  margin: 0 10px;
  padding:10px 0;
  background-color: white;
  text-indent: 10px;
  border-radius: 10px;
}
.fujin>div{
  width: calc(100vw - 20px);
  height: 26vh;
  border-bottom: 1px solid rgb(202, 201, 201);
  display: flex;
  /* padding: 10px 0; */
  margin: 10px;
  border-radius: 10px;
  background-color: white;
}
.fujin img{
  width: 18vw;
  height: 18vw;
}
.tuijian {
    width: 96vw;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    border-radius: 6px;
    background-color: rgb(253, 253, 253);
}

.tuijian>div {
    margin: 15px 10px 0 15px;
}

.tuijian img {
    width: 34vw;
}

.tuijian h2 {
    /* display: block; */
    font-size: 16px;
    padding: 3px 0;
}

.tuijian p {
    font-size: 12px;
    padding: 3px 0;
}

.tuijian>div>a {
    color: orange;
}

.huiyuan {
    width: 96vw;
    margin: 5px auto;
    background-image: linear-gradient(90deg, #ffefc4, #f3dda0);
    display: flex;
    justify-content: space-between;
    /* align-items: flex-end; */
    padding: 8px 0;
}

.huiyuan>div:nth-of-type(1) {
    margin-left: 10px;
    display: flex;
}

.huiyuan>div:nth-of-type(1) h2 {
    font-size: 13px;
    color: gray;
    margin-left: 5px;
}

.huiyuan>div:nth-of-type(1) .qi {
    font-size: 10px;
    color: gray;
    margin-top: 2px;
    margin-left: 5px;
}

.huiyuan>div:nth-of-type(2) {
    margin-right: 10px;
}

.huiyuan>div:nth-of-type(2) p {
    font-size: 10px;
    color: black;
    margin-top: 2px;
}
.fujin{
  width: 100vw;
  background-color: white;
}
footer {
    width: 94vw;
    margin: 0 auto;
    /* background-color: white; */
}

footer .head {
    width: 34vw;
    margin: 10px auto;
    padding-top: 10px;
    display: flex;
    justify-content: space-between;
}

footer .head div {
    font-weight: normal;
    font-size: 15px;
    /* border-top: 1px solid gray; */
}

footer .head p {
    width: 5vw;
    border-top: 1px solid gray;
    margin-top: 8px;
}

footer nav {
    width: 92vw;
    height: 7vh;
    padding: 0 4vw;
    margin-left: -4vw;
    line-height: 7vh;
    /* margin: 20px auto; */
}

footer nav>ul {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: rgb(104, 104, 104);
}

footer nav>ul li:nth-of-type(1) {
    display: flex;
}

.sj {
    width: 0px;
    height: 0px;
    border: 4px solid;
    border-color: transparent transparent rgb(134, 133, 133) transparent;
    transform: rotate(180deg);
    margin: 17px 0 0 5px;
}

.content section:nth-of-type(1) {
    display: flex;
    justify-content: space-between;
    margin-top: 4vh;
}

.content section:nth-of-type(1)>div:nth-of-type(1) {
    width: 50vw;
    display: flex;
    justify-content: space-between;
}

.content section:nth-of-type(1)>div:nth-of-type(1) img {
    width: 18vw;
    height: 18vw;
}

.content .zhuan {
    width: 30vw;
    display: flex;
    flex-wrap: wrap;
    justify-content: end;
    height: 10vh;
    align-content: space-between;
}

.zhuan>p {

    font-size: 12px;
    color: rgb(131, 130, 130);
}

.zhuan>p:nth-of-type(1) {
    width: 25vw;
    text-align: end;
}

.zhuan>p:nth-of-type(2) {
    color: white;
    padding: 1px 3px;
    background-color: rgb(95, 95, 218);
}

.pin {
    display: flex;
    margin-bottom: 4px;
}

.pin>p {
    font-size: 10px;
    width: 28px;
    height: 15px;
    line-height: 15px;
    background-color: yellow;
    text-align: center;
    margin-right: 5px;
    margin-top: 1px;
}

.pin h2 {
    font-size: 14px;
}
.px{
    margin-left: 2vw;
}
.px h2{
    width: 18vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

}
.px>p {
    font-size: 12px;
    color: #666;
    font-family: 'Helvetica Neue', Tahoma, Arial, PingFangSC-Regular, 'Hiragino Sans GB', 'Microsoft Yahei', sans-serif;
    padding: 3px 0;
}

.hj {
    /* width: 15vw; */
    padding: 0;
    margin: 0;
    font-style: normal;
    font-size: 12px;
    text-align: center;
    background-color: aliceblue;
    box-shadow: 1px 1px 1px gray;
}

.zi {
    margin-top: 3vh;
    margin-left: 20vw;
    display: flex;
    margin-bottom: 3vh;
    justify-content: space-between;
}

.zi p {
    font-size: 10px;
    color: gray;
    padding: 3px 0;
    cursor: pointer;
}

.zi>div:nth-of-type(1)>p:nth-of-type(1) {
    width: 58vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zi>div>p span {
    color: white;
    border-radius: 2px;
    padding: 0 2px;
    margin-right: 4px;
}

.zi>div>p:nth-of-type(1) span {
    background-color: red;
}

.zi>div>p:nth-of-type(2) span {
    background-color: green;
}

.heng {
    display: flex;
}

.heng .sj {
    margin: 0;
    margin-top: 6px;
    margin-left: 3px;
}

.line {
    width: 92vw;
    margin-left: -4vw;
    padding: 0 4vw;
    border-bottom: 1px solid rgb(201, 200, 200);
}

</style>
